import { create, update, remove, query } from '../../../../framework/service/index';

export default {

  namespace: 'jobConsultList',

  state: {
    data: [],
    list: {},
    jobConsults: []
  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(location => {
        if(location.pathname === '/job-consult-list') {
          // dispatch({
          //   type: 'query',
          //   payload: {
          //     id: location.query.id
          //   }
          // })
        }
      })
    },
  },

  effects: {
    *query({ payload }, { call, put }) {  // eslint-disable-line  /api/members/list
      console.log('payload',payload.id);
      const { code, data, message } = yield call(query, `/api/job/${payload.id}`, {});
      console.log('id搜兼职',data);
      if (code === 200 && data) {
        // yield put({
        //   type: 'querySuccess',
        //   payload: {
        //     list: data
        //   }
        // })
      }
    },
  },

  reducers: {
    querySuccess(state, action) {
      return { ...state, ...action.payload };
    },
  }

};
